﻿<!DOCTYPE html>
<!--
Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
For licensing, see LICENSE.html or https://ckeditor.com/legal/ckeditor-oss-license/
-->
<html>
<head>
	<title>Replace Textarea by Code &mdash; CKEditor Sample</title>
	<meta charset="utf-8">
	<script src="../ckeditor.js"></script>
	<link href="sample.css" rel="stylesheet">
</head>
<body>
	<h1 class="samples">
		<a href="index.html">CKEditor Samples</a> &raquo; Replace Textarea Elements Using JavaScript Code
	</h1>
	<form action="sample_posteddata.php" method="post">
		<div class="description">
			<p>
				This editor is using an <code>&lt;iframe&gt;</code> element-based editing area, provided by the <strong>Wysiwygarea</strong> plugin.
			</p>
<pre class="samples">
CKEDITOR.replace( '<em>textarea_id</em>' )
</pre>
		</div>
		<textarea cols="80" id="editor1" name="editor1" rows="10">
			&lt;h1&gt;
				&lt;img alt="" src="https://a.cksource.com/c/1/inc/img/demo-little-red.jpg" style="margin-left: 10px; margin-right: 10px; float: left; width: 120px; height: 168px;" /&gt;Little Red Riding Hood&lt;/h1&gt;
			&lt;p&gt;
				&quot;&lt;b&gt;Little Red Riding Hood&lt;/b&gt;&quot; is a famous &lt;a href="https://en.wikipedia.org/wiki/Fairy_tale" title="Fairy tale"&gt;fairy tale&lt;/a&gt; about a young girl&#39;s encounter with a wolf. The story has been changed considerably in its history and subject to numerous modern adaptations and readings.&lt;/p&gt;
			&lt;table align="right" cellpadding="1" cellspacing="1" style="width: 200px;"&gt;
				&lt;caption&gt;
					&lt;strong&gt;International Names&lt;/strong&gt;&lt;/caption&gt;
				&lt;tbody&gt;
					&lt;tr&gt;
						&lt;td&gt;
							Chinese&lt;/td&gt;
						&lt;td&gt;
							&lt;i&gt;小紅帽&lt;/i&gt;&lt;/td&gt;
					&lt;/tr&gt;
					&lt;tr&gt;
						&lt;td&gt;
							Italian&lt;/td&gt;
						&lt;td&gt;
							&lt;i&gt;Cappuccetto Rosso&lt;/i&gt;&lt;/td&gt;
					&lt;/tr&gt;
					&lt;tr&gt;
						&lt;td&gt;
							Spanish&lt;/td&gt;
						&lt;td&gt;
							&lt;i&gt;Caperucita Roja&lt;/i&gt;&lt;/td&gt;
					&lt;/tr&gt;
				&lt;/tbody&gt;
			&lt;/table&gt;
			&lt;p&gt;
				The version most widely known today is based on the &lt;a href="https://en.wikipedia.org/wiki/Brothers_Grimm" title="Brothers Grimm"&gt;Brothers Grimm&lt;/a&gt; variant. It is about a girl called Little Red Riding Hood, after the red &lt;a href="https://en.wikipedia.org/wiki/Hood_%28headgear%29" title="Hood (headgear)"&gt;hooded&lt;/a&gt; &lt;a href="https://en.wikipedia.org/wiki/Cape" title="Cape"&gt;cape&lt;/a&gt; or &lt;a href="https://en.wikipedia.org/wiki/Cloak" title="Cloak"&gt;cloak&lt;/a&gt; she wears. The girl walks through the woods to deliver food to her sick grandmother.&lt;/p&gt;
			&lt;p&gt;
				A wolf wants to eat the girl but is afraid to do so in public. He approaches the girl, and she na&iuml;vely tells him where she is going. He suggests the girl pick some flowers, which she does. In the meantime, he goes to the grandmother&#39;s house and gains entry by pretending to be the girl. He swallows the grandmother whole, and waits for the girl, disguised as the grandmother.&lt;/p&gt;
			&lt;p&gt;
				When the girl arrives, she notices he looks very strange to be her grandma. In most retellings, this eventually culminates with Little Red Riding Hood saying, &quot;My, what big teeth you have!&quot;&lt;br /&gt;
				To which the wolf replies, &quot;The better to eat you with,&quot; and swallows her whole, too.&lt;/p&gt;
			&lt;p&gt;
				A &lt;a href="https://en.wikipedia.org/wiki/Hunter" title="Hunter"&gt;hunter&lt;/a&gt;, however, comes to the rescue and cuts the wolf open. Little Red Riding Hood and her grandmother emerge unharmed. They fill the wolf&#39;s body with heavy stones, which drown him when he falls into a well. Other versions of the story have had the grandmother shut in the closet instead of eaten, and some have Little Red Riding Hood saved by the hunter as the wolf advances on her rather than after she is eaten.&lt;/p&gt;
			&lt;p&gt;
				The tale makes the clearest contrast between the safe world of the village and the dangers of the &lt;a href="https://en.wikipedia.org/wiki/Enchanted_forest" title="Enchanted forest"&gt;forest&lt;/a&gt;, conventional antitheses that are essentially medieval, though no written versions are as old as that.&lt;/p&gt;
		</textarea>
		<script>

			// This call can be placed at any point after the
			// <textarea>, or inside a <head><script> in a
			// window.onload event handler.

			// Replace the <textarea id="editor"> with an CKEditor
			// instance, using default configurations.
			CKEDITOR.replace( 'editor1' );

		</script>
		<p>
			<input type="submit" value="Submit">
		</p>
	</form>
	<div id="footer">
		<hr>
		<p>
			CKEditor - The text editor for the Internet - <a class="samples" href="https://ckeditor.com/">https://ckeditor.com</a>
		</p>
		<p id="copy">
			Copyright &copy; 2003-2022, <a class="samples" href="https://cksource.com/">CKSource</a> Holding sp. z o.o. All rights reserved.
		</p>
	</div>
</body>
</html>
